# Makefile to compile all .cc files in current directory into executables

# Get all .cc files in current directory
CC_FILES := $(wildcard *.cc)

# Generate corresponding executable names (remove .cc extension)
EXECUTABLES := $(patsubst %.cc,%,$(CC_FILES))

# Compiler settings
CXX := g++
CXXFLAGS := -Wall -Wextra -std=c++17 
LDFLAGS := -llog4cpp -lpthread

# Default target: build all executables
all: $(EXECUTABLES)

# Pattern rule: how to build an executable from .cc file
%: %.cc
	$(CXX) $(CXXFLAGS) $< -o $@ $(LDFLAGS)

# Clean up all generated executables
clean:
	rm -f $(EXECUTABLES)

# Phony targets (not real files)
.PHONY: all clean